<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
        {% if block('title') is defined %} <title>{{ block('title') }} - PHPDish</title> {% else %}{{ sonata_seo_title() }} {% endif %}
        {{ sonata_seo_metadatas() }}
        {{ sonata_seo_link_canonical() }}
        {{ sonata_seo_lang_alternates() }}
        <link rel="icon" href="/favicon.ico" type="image/x-icon"/>
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
        <link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
        <link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
        <link href="//at.alicdn.com/t/font_382846_1bc5ry0cwvobt9.css"  rel="stylesheet">
        <link href="{{ asset('build/vendor.css') }}" rel="stylesheet">
        <link href="{{ asset('build/css/style.css') }}" rel="stylesheet">
        {% block css %}{% endblock %}
    </head>
    <body>
        <div class="main-body">
            <div class="navbar navbar-default navbar-fixed-top" role="banner" data-role="navbar">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".header-navbar-collapse">
                            <span class="sr-only">切换菜单</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand logo"><img src="{{ asset('/img/5.png') }}" class="img-responsive"/></a>
                    </div>
                    <nav class="collapse navbar-collapse header-navbar-collapse" role="navigation">
                        {{ knp_menu_render('main_menu', {'currentClass': 'active'}) }}
                        <form class="navbar-form navbar-left top-search" action="/search">
                            <div class="form-group">
                                <input type="text" name="q" value="{{ app.request.query.get('q') }}" class="form-control query" placeholder="搜索">
                            </div>
                            <button type="submit" class="btn btn-default"><i class="if i-search"></i></button>
                        </form>

                        <ul class="nav navbar-nav navbar-right nav-profile">
                            {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
                                <li class="nav-notifications">
                                    <a href="{{ path('notifications') }}">
                                        <i class="if i-bell-o"></i>
                                        {% set unreadNotificationNumber = fos_message_nb_unread() + notification_unseen_number() %}
                                        <span class="badge notification-number{% if unreadNotificationNumber %} has-message {% endif %}" id="notification-number" data-number="{{ unreadNotificationNumber }}">
                                            {{ unreadNotificationNumber }}
                                        </span>
                                    </a>
                                </li>
                                <li class="dropdown">
                                    <a href="{{ path('topic_add') }}" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                        <i class="if i-plus-bold"></i>
                                    </a>
                                    <ul class="dropdown-menu popover-menu">
                                        <li role="separator" class="arrow"></li>
                                        <li><a href="{{ path('topic_add') }}"><i class="if i-comment-square"></i> 发起话题</a></li>
                                        <li><a href="{{ path('post_add') }}"><i class="if i-post-o"></i> 发布文章</a></li>
                                    </ul>
                                </li>
                                <li class="dropdown nav-user">
                                    <a class="dropdown-toggle avatar" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                        <img src="{{ asset(app.user.avatar)|imagine_filter('middle_square') }}"  class="img-responsive img-circle"/>
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu popover-menu">
                                        <li role="separator" class="arrow"></li>
                                        <li><a href="{{ path('user_view', {username: app.user.username}) }}"><i class="if i-user"></i> 我的主页</a></li>
                                        <li><a href="{{ path('setting_profile') }}"><i class="if i-setting-o"></i> 设置</a></li>
                                        <li role="separator" class="divider"></li>
                                        <li><a href="{{ path('logout') }}"><i class="if i-logout"></i> 退出</a></li>
                                    </ul>
                                </li>
                            {% else %}
                                <li>
                                    <a href="{{ path('login') }}">登录</a>
                                </li>
                                <li>
                                    <a href="{{ path('register') }}" class="btn btn-sm u-btn-outline-primary btn-register">注册</a>
                                </li>
                            {% endif %}
                        </ul>
                    </nav>
                </div>
            </div>
            <div class="masthead" id="content-container">
            {% block content %}
            {% endblock %}
            </div>
            {% block footer %}
            <footer class="footer">
                <div class="container">
                    <div class="panel panel-default">
                        <div class="panel-body">{{ render(controller('PHPDishCoreBundle:FriendLink:list', {'limit': 5})) }}</div>
                        <div class="panel-footer clearfix">
                            <ul class="targets list-inline list-unstyled">
                                <li>2017 &copy; PHPDish. All Rights Reserved.</li>
                                <li><a href="http://www.miitbeian.gov.cn/" target="_blank">皖ICP备14022941号</a></li>
                                <li>
                                    Powered by <a href="https://github.com/slince/phpdish">PHPDish</a>
                                    <a target="_blank" href="https://github.com/slince/phpdish"><img src="https://img.shields.io/github/stars/slince/phpdish.svg?style=social&label=Stars"></a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </footer>
            {% endblock %}
        </div>
        <script type="text/javascript" src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
        <script type="text/javascript" src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="//cdn.bootcss.com/lodash.js/4.17.4/lodash.min.js"></script>
        <script type="text/javascript" src="{{ asset('build/manifest.js') }}"></script>
        <script type="text/javascript" src="{{ asset('build/vendor.js') }}"></script>
        {% block script %}{% endblock %}

        <script>
            var _hmt = _hmt || [];
            (function() {
                var hm = document.createElement("script");
                hm.src = "https://hm.baidu.com/hm.js?2c90d5dd217ebc4a0d14a61fde2aa1fa";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
    </body>
</html>